<template>
    <div class="big-box">
        <div class="header">
            <img src="../../../../../assets/bigScreen/header4.png" alt="" />
            <div class="backBox" @click="goBack"></div>
        </div>
        <div class="backToBox">
            <div class="backTo" @click="gotoHome">
                <div>返回总窗口</div>
            </div>
            <div class="backTo" @click="backToOne">
                <div>返回上一页</div>
            </div>
        </div>
        <div class="centerBox">
            <div class="sreenTitle">融资需求</div>
            <div class="center">
                <div class="det-top">
                    <div class="det-tl">
                        <img :src="detail.img[0] == '/' ? baseURL + detail.img : detail.img" alt="暂无图片" v-if="detail.img">
                        <img src="../../../../../assets/informition/active-default.png" alt="暂无图片" v-else>
                    </div>
                    <div class="det-tr">
                        <div class="flex">
                            <h3 style="color: #037DFF;">{{detail.name}}</h3>
                            <!-- <div class="det-tag">{{detail.financingMethod}}</div> -->
                        </div>
                        <div class="det-tr-con">
                            <div class="flex">
                                <div>企业融资金额：<span style="color: #FFEF09">{{detail.amount}}</span></div>
                                <div>企业名称：<span>{{detail.enterpriseName}}</span></div>
                            </div>
                            <div class="flex">
                                <div>融资地区：<span>{{detail.financingArea}}</span></div>
                                <div>统一社会信用代码：<span>{{detail.code}}</span></div>
                            </div>
                            <div class="flex">
                                <div>融资类型：<span>{{detail.financingMode}}</span></div>
                                <div>所属行业：<span>{{detail.industry}}</span></div>
                            </div>
                            <div class="flex">
                                <div>融资形式：<span>{{detail.financingMethod}}</span></div>
                                <div>所在地区：<span>{{detail.financingArea}}</span></div>
                            </div>
                            <div class="flex">
                                <div>担保方式：<span>{{detail.warrant}}</span></div>
                                <div>手机号码：<span>{{detail.mobile || '158****8925'}}</span></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import {
    baseUrl
} from '../../../../../../config';
import {
    capitalDetailRecommend
} from "../../../../../api/globalSearch"
import headerBox from "../../../../../components/header.vue"
import headerImg from "../../../../../components/headerImg.vue"
import footerBox from "../../../../../components/footer-box.vue"
// import actTabs from "./components/act-tabs.vue"
import { getFinancingProjectDetail } from "../../../../../api/capital"
import { messageAdd, getMessageDet, getMessageDetSingle } from '../../../../../api/message.js';
export default {
    components: {
        headerBox,
        headerImg,
        footerBox
        // actTabs
    },
    data() {
        return {
            list: [],
            baseURL: undefined,
            wrapperStyle: {
                width: '20rem'
            },
            tabList: ['最新资讯', '最新活动'],
            tabAct: 1,
            detail: {},
            detList: [],
            ifChat: false,
            chatData: {},
            chatList: [],
            chatCon: null,
            msgId: null,
            falseData: {
                id: 209,
                name: '联系人'
            },
            userId: localStorage.getItem("userId")
        }
    },
    mounted() {
        console.log(this.$route.query);
        this.baseURL = baseUrl
        this.getDet(this.$route.query.id);
        // this.getDetList(this.$route.query.id);
    },
    methods: {
        getMatch() {
            // console.log(item.id);
            capitalDetailRecommend({
                industry: this.detail.industry
            }).then((response) => {
                this.list.value = [];
                if (response.code == 200) {
                    this.list = response.data;
                } else {
                    this.list = []
                }
            }).catch(err => {
                this.list = []
            })
        },
        // 阻止点击的默认事件修改路由
        handleAnchorClick(e, link) {
            e.preventDefault();
            var srcolls = document.getElementById(link.href);
            srcolls.scrollIntoView({
                block: 'start',
                behavior: 'smooth'
            });
        },
        toDetail(item, type) {
            console.log(item.id);
            var url = '';
            if (type == 1) { //投资机构
                url = 'publishSuccessDetail'
            }
            // if (type == 3) {
            // url = '/scientificOrgDetail'
            // }
            if (type == 2) { //投资人
                url = 'capitalPersonal'
            }
            this.$router.push({
                path: url,
                query: {
                    id: item.id
                }
            })
        },
        getDet(id) {
            getFinancingProjectDetail(id).then(res => {
                if (res.code === 200) {
                    this.detail = res.data;
                    this.getMatch();
                }
            })
        },
        toPage() {
            this.$router.push({
                path: './assistance'
            })
        },
        gotoChat(v) {
            this.chatData = v;
            this.ifChat = true;
            this.msgId = v.id;
            this.getChatDet(v.id);
        },
        getChatDet(id) {
            getMessageDetSingle({ receiveId: id, receiveType: '3' }).then(res => {
                if (res.code === 200) {
                    this.chatList = res.data;
                    this.$nextTick(() => {
                        let scrollEl = this.$refs.mianscroll;
                        scrollEl.scrollTo({ top: scrollEl.scrollHeight, behavior: 'smooth' });
                    });
                }
            })
        },
        chatSub() {
            if (this.chatCon) {
                messageAdd({
                    receiveType: 3,//1 投资人  2 经纪人 3融资需求
                    content: this.chatCon,
                    receiveId: this.msgId,
                }).then(res => {
                    if (res.code === 200) {
                        this.chatCon = null;
                        this.getChatDet(this.msgId);
                    }
                })
            }
        },
        gotoHome() {
            this.$router.push({
                path: '/bigScreenIndex',
            })
        },
        backToOne() {
            console.log('11');
            this.$router.go(-1)
        },
        goBack() {
            this.$router.push('/chart')
        }
        // getDetList(id) {
        // 	getActivityDetList({id: id}).then(res=>{
        // 		if(res.code === 200) {
        // 			this.detList = res.data?res.data.list:[];
        // 		}
        // 	})
        // },
        // gotoDet(id) {
        // 	this.$router.push({
        // 		path: 'activitiesDetail',
        // 		query: {
        // 			id: id
        // 		}
        // 	})
        // }
    }
}
</script>

<style scoped lang="scss">
@font-face {
    font-family: "ffa";
    src: url(../../../assets/bigScreen/fonts/DS-DIGIB.TTF);
}
ul,
li {
    list-style: none;
}
.big-box {
    background-color: #071c3b;
    height: 100vh;
}
.header {
    position: relative;
    text-align: center;
    position: relative;
    height: 19.1rem;

    .backBox {
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 70rem;
        height: 10rem;
        cursor: pointer;
    }

    > img {
        width: 100%;
        max-height: 100%;
        margin-top: -1.1rem;
        image-rendering: -moz-crisp-edges; /* Firefox */
        image-rendering: -o-crisp-edges; /* Opera */
        image-rendering: -webkit-optimize-contrast; /* Webkit (non-standard naming) */
        image-rendering: crisp-edges;
        -ms-interpolation-mode: nearest-neighbor; /* IE (non-standard property) */
    }
}
.centerBox {
    width: 96%;
    margin: 0 auto;
    position: absolute;
    top: 14rem;
    left: 2%;
    .sreenTitle {
        background-image: url("../../../../../assets/bigScreen/sreenTitle.png");
        background-size: 100% 100%;
        height: 3.8rem;
        padding-left: 35px;
        font-weight: 600;
        color: #fff;
        display: flex;
        align-items: center;
    }
    .center {
        margin-top: 1rem;
        height: calc(100vh - 20rem);
        border: 1px solid;
        border-image: linear-gradient(
                130deg,
                #2385df 0%,
                rgba(35, 133, 223, 0.65) 92%
            )
            1;
        overflow-y: scroll;
        padding: 20px;

        .det-top {
            width: 140rem;
            margin: 5rem auto;
            border: 0.1rem solid #4494ff46;
            border-radius: 0.8rem;
            display: flex;
            justify-content: space-between;
            flex-wrap: wrap;
            padding: 4rem;

            .det-tl {
                width: 61.5rem;
                height: 40.8rem;
                margin-right: 4.5rem;

                img {
                    width: 100%;
                    height: 100%;
                    object-fit: cover;
                }
            }

            .det-tr {
                width: 65rem;

                h3 {
                    font-size: 2.4rem;
                    line-height: 2.9rem;
                    color: #000;
                }

                .det-tag {
                    font-size: 1.2rem;
                    line-height: 1.4rem;
                    color: #fff;
                    padding: 0.4rem 1.2rem;
                    border-radius: 0.4rem;
                    margin: 1.4rem auto 2rem;
                    display: inline-block;
                    background: #007fff;
                }

                .haveIn {
                    background: #ffbd02;
                }

                .closed {
                    background: #aeaeae;
                }

                .det-tr-con {
                    font-size: 1.8rem;
                    line-height: 2.2rem;
                    color: #a7a7a7;

                    div {
                        margin-top: 1.3rem;
                    }
                    span {
                        color: #fff;
                    }
                }
            }
        }
    }
    ::-webkit-scrollbar {
        width: 5px;
        height: 10px;
    }

    /* 滚动条轨道 */
    ::-webkit-scrollbar-track {
        background-color: #234470;
    }

    /* 滚动条滑块 */
    ::-webkit-scrollbar-thumb {
        background-color: #061c57;
    }

    /* 鼠标悬停在滚动条上的滑块 */
    ::-webkit-scrollbar-thumb:hover {
        background-color: #555;
    }
}
.backToBox {
    position: absolute;
    top: 8rem;
    right: 2%;
    display: flex;
    z-index: 10;
    .backTo {
        background-image: url("../../../../../assets/bigScreen/backTo.png");
        color: #2dccff;
        background-size: 100% 100%;
        width: fit-content;
        padding: 2px 40px 10px 10px;
        font-weight: 600;
        cursor: pointer;
        margin-left: 10px;
        div {
            padding-top: 5px;
        }
    }
}
</style>
